home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / swingall.jar / javax / swing / text / DefaultEditorKit$BeginLineAction.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-07-15  |  1.2 KB  |  35 lines

  1. package javax.swing.text;
  2.  
  3. import java.awt.Component;
  4. import java.awt.Point;
  5. import java.awt.event.ActionEvent;
  6.  
  7. class DefaultEditorKit$BeginLineAction extends TextAction {
  8.    private boolean select;
  9.  
  10.    DefaultEditorKit$BeginLineAction(String var1, boolean var2) {
  11.       super(var1);
  12.       this.select = var2;
  13.    }
  14.  
  15.    public void actionPerformed(ActionEvent var1) {
  16.       JTextComponent var2 = ((TextAction)this).getTextComponent(var1);
  17.       if (var2 != null) {
  18.          try {
  19.             int var3 = var2.getCaretPosition();
  20.             int var4 = Utilities.getRowStart(var2, var3);
  21.             if (this.select) {
  22.                var2.moveCaretPosition(var4);
  23.             } else {
  24.                var2.setCaretPosition(var4);
  25.             }
  26.  
  27.             var2.getCaret().setMagicCaretPosition((Point)null);
  28.          } catch (BadLocationException var5) {
  29.             ((Component)var2).getToolkit().beep();
  30.          }
  31.       }
  32.  
  33.    }
  34. }
  35.